﻿using System;
using Autodesk.Revit.DB;

namespace YJKPreviewerControl.Utils
{
	public class ThicknessOfEdgeInfo : EdgeInfo
	{
		public double Thickness
		{
			get
			{
				return this.m_Thickness;
			}
			set
			{
				this.m_Thickness = value;
			}
		}

		public ThicknessOfEdgeInfo(ThicknessOfEdgeInfo other) : base(other.StartPoint, other.EndPoint, other.Bulge)
		{
			this.m_Thickness = other.Thickness;
		}

		public ThicknessOfEdgeInfo(XYZ startPoint, XYZ endPoint, double bulge, double thickness) : base(EdgeInfo.Get2DXYZ(startPoint), EdgeInfo.Get2DXYZ(endPoint), bulge)
		{
			this.m_Thickness = thickness;
		}

		public ThicknessOfEdgeInfo(Curve curve, double thickness) : base(curve, false)
		{
			this.m_Thickness = thickness;
		}

		public void GetDoubleLine(ref EdgeInfo negativeLine, ref EdgeInfo positiveLine)
		{
			if (base.IsArc)
			{
				bool flag = true;
				if (base.Normal.IsAlmostEqualTo(-XYZ.BasisZ))
				{
					flag = false;
				}
				double num = -1.0;
				if (flag)
				{
					num = 1.0;
				}
				negativeLine = EdgeInfo.Offset(this, -this.m_Thickness / 2.0 * num);
				positiveLine = EdgeInfo.Offset(this, this.m_Thickness / 2.0 * num);
				return;
			}
			negativeLine = EdgeInfo.Offset(this, -this.m_Thickness / 2.0);
			positiveLine = EdgeInfo.Offset(this, this.m_Thickness / 2.0);
		}

		private double m_Thickness;
	}
}
